package com.vhall.component.entity.message;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;

import java.io.Serializable;

/**
 * 上下麦广播消息
 *
 * @author yuanzh
 * @date 2021/9/15
 */
@Data
public class MicBroadcastMessageDTO implements Serializable {

    private static final long serialVersionUID = 3056305013006563054L;

    /**
     * required 消息类型
     */
    @JSONField(name = "type")
    private String messageType;

    /**
     * required 用户昵称
     */
    @JSONField(name = "nick_name")
    private String nickName;

    /**
     * required 操作者用户id
     */
    @JSONField(name = "room_join_id")
    private String roomJoinId;

    /**
     * required 用户角色
     */
    @JSONField(name = "room_role")
    private String roomRole;

    /**
     * required 操作目标用户id
     */
    @JSONField(name = "target_id")
    private String targetId;

    /**
     * required 设备类型，0=其他 1=手机端 2=PC
     */
    @JSONField(name = "device_type")
    private Integer deviceType;

    public static class Builder {

        private final MicBroadcastMessageDTO message;

        public Builder(String messageType) {
            this.message = new MicBroadcastMessageDTO();
            this.message.setMessageType(messageType);
        }

        public MicBroadcastMessageDTO build() {
            return this.message;
        }

        public Builder setOperatorInfo(String nickname, String roomJoinId, String roomRole, Integer deviceType) {
            this.message.setNickName(nickname);
            this.message.setRoomJoinId(roomJoinId);
            this.message.setRoomRole(roomRole);
            this.message.setDeviceType(deviceType);
            return this;
        }

        public Builder setTargetInfo(String targetId) {
            this.message.setTargetId(targetId);
            return this;
        }
    }
}
